{extend name="public/base" /}
{block name="button"}
<button data-table-id="OplogTable" data-action='{:url("remove")}' data-rule="id#{id}" data-confirm="确定要删除选中的日志吗？" class='layui-btn layui-btn-sm layui-btn-primary'>批量删除</button>
<button data-table-id="OplogTable" data-load='{:url("clear")}' data-confirm="确定要清空所有日志吗？" class='layui-btn layui-btn-sm layui-btn-primary'>清空数据</button>
{/block}
{block name="content"}
<form class="layui-form layui-form-pane form-search" action="{:url()}" onsubmit="return false" method="post" autocomplete="off">
    <div class="layui-form-item layui-inline">
        <label class="layui-form-label">操作人账号</label>
        <label class="layui-input-inline">
            <input name="user_name" value="" placeholder="" class="layui-input">
        </label>
    </div>
    <div class="layui-form-item layui-inline">
        <label class="layui-form-label">操作人id</label>
        <label class="layui-input-inline">
            <input name="user_id" value="" placeholder="" class="layui-input">
        </label>
    </div>
    <div class="layui-form-item layui-inline">
        <label class="layui-form-label">操作url</label>
        <label class="layui-input-inline">
            <input name="url" value="" placeholder="" class="layui-input">
        </label>
    </div>
    <div class="layui-form-item layui-inline">
        <label class="layui-form-label">所属模块</label>
        <div class="layui-input-inline">
            <select name="module" lay-search class="layui-select">
                <option value='0'>全部</option>
                {volist name="Think.config.global.MODULE_MAPPING" id="module" }
                <option value="{$key}">{$module}</option>
                {/volist}
            </select>
        </div>
    </div>
    <div class="layui-form-item layui-inline">
        <label class="layui-form-label">访问时间</label>
        <div class="layui-input-inline">
            <input data-date-range name="create_at" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item layui-inline">
        <button class="layui-btn layui-btn-primary"><i class="layui-icon">&#xe615;</i>搜索</button>
    </div>
</form>
<table id="OplogTable"  data-url="{:url('index')}" data-target-search="form.form-search"></table>
{/block}
{block name='script'}
<script>
    $(function () {
        $('#OplogTable').layTable({
            even: true,
            height: 'full',
            method: 'post',
            sort: {field: 'id', type: 'desc'},
            url: "{:url('index')}" ,
            page: true,
            cols: [[
                {checkbox: true, fixed: true},
                {field: 'id', title: 'id', width: 100, align: 'center'},
                {field: 'user_id', title: '用户id', minWidth: 100, align: 'center'},
                {field: 'user_name', title: '账号', minWidth: 100, align: 'center'},
                {field: 'module', title: '模块', minWidth: 100, align: 'center'},
                {field: 'url', title: 'url', align: 'center', minWidth: 100},
                {field: 'params', title: '参数', align: 'center', minWidth: 110},
                {field: 'ip', title: '所属ip', align: 'center', minWidth: 110},
                {field: 'create_at', title: '创建', align: 'center', minWidth: 170, sort: true},
                {field: 'update_at', title: '更新时间', align: 'center', minWidth: 170, sort: true},
            ]]
        });
        // 数据状态切换操作
        $.menu.highlight_subnav("{:url('index')}")
    });
</script>
{/block}
